<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>

<body>
    <div id="root">
    
        <h3>a的值是：{{numbers.a}}</h3>
        <button @click="numbers.a++">点我让a+1</button>
        
        <h3>b的值是：{{numbers.b}}</h3>
        <button @click="numbers.b++">点我让b+1</button>
    </div>
    <script>
        const vm = new Vue({
            el: "#root",
            data: {
                numbers:{
                    a:1,
                    b:2
                }
            },
            watch: {
                //监视多级结构中某个数据的变化
                'numbers':{
                    deep:true,
                    handler(){
                        console.log('改变了');
                    }
                }
            }
            
        })
       
    </script>
</body>

</html>